//
//  ShowMessageTableViewCell.m
//  Taste
//
//  Created by 徐昊 on 16/9/21.
//  Copyright © 2016年 徐昊. All rights reserved.
//

#import "ShowMessageTableViewCell.h"
#import "ShowMessageRes.h"
#import "NSString+HX_TimeInterval.h"
#import "UIImageView+WebCache.h"
#import "NSString+Vali.h"

@interface ShowMessageTableViewCell ()
@property (weak, nonatomic) IBOutlet UIImageView *photo;
@property (weak, nonatomic) IBOutlet UILabel *name;
@property (weak, nonatomic) IBOutlet UILabel *comment;
@property (weak, nonatomic) IBOutlet UILabel *time;
@property (weak, nonatomic) IBOutlet UIImageView *commentPic;

@end
@implementation ShowMessageTableViewCell

- (void)setRes:(ShowMessageRes *)res {
    _res = res;
    _name.text = res.nickname;
    [_photo sd_setImageWithURL:[NSURL URLWithString:[NSString imageWebWithStr:_res.headimg]] placeholderImage:[UIImage imageNamed:@"IMG_Universal_Placeholder_Avatar"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
    }];
    _comment.text = res.msg;
    _time.text = [NSString updateTimeForTimeIntervalString:_res.addtime];
    [_commentPic sd_setImageWithURL:[NSURL URLWithString:[NSString imageWebWithStr:_res.pic]] placeholderImage:[UIImage imageNamed:@"IMG_Universal_Placeholder"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
    }];
}

- (void)awakeFromNib {
    // Initialization code
    [super awakeFromNib];
    [self layoutIfNeeded];
    _photo.layer.masksToBounds = YES;
    _photo.layer.cornerRadius = _photo.frame.size.width / 2.0;
    _photo.contentMode = UIViewContentModeScaleAspectFill;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
